<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@include file="../base.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>	
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../../js/jquery.select.js"></script>
<script type="text/javascript" src="js/categoryMag.js"></script>
<style type="text/css">
	table, tr ,td{border: 1px solid #99BBE8; padding:5px; border-collapse: collapse;}
</style>
<script type="text/javascript">
	
</script>
</head>
<body class="font14">
	<font color="red">
		<s:property value="#attr.result" />
	</font>
	<table id="treeTable2" width="100%" >
		<tr style="background-color: #DEE9FB; color: #15428B; font-weight: bold;">
			<td>一级类别</td>
			<td>二级类别</td>
			<td>三级类别</td>
			<td>属性类型</td>
			<td>属性值</td>
		</tr>
		<tr>
			<td>   
					    <select
							id="category1Select"
							style="width: 160px;"
							size="15"
						onchange="javascript:queryCategory2ByCategory1();"
						/>
				</td>
			<td>
					<select 
						id="category2Select"
						style="width: 160px;"
						size="15"
						onchange="javascript:queryCategory3ByCategory2();"
						/>
			</td>
			<td>
					<select 
						id="category3Select"
						style="width: 160px;"
						size="15"
						onchange="javascript:queryPropertyTypeByCategory3();"
						/>
			</td>
			<td>
					<select 
						id="propertyTypeSelect"
						style="width: 160px;"
						size="15"
						onchange="javascript:queryPropValueByPropType();"
						/>
			</td>
			<td>
					<select 
						id="propertyValueSelect"
						style="width: 160px;"
						size="15"
						onchange="javascript:onChangePropValueSelect();"
						/>
			</td>
		</tr> 
		<tr>
			<td>
				<input type="text" name="category1Name" id="category1Name" maxlength="20" size="14">
				<br/>
				<input type="submit" id="addCategory1Id" value="添加一级类别" onclick="javascript:addCategory1();">
				<input type="checkbox" name="check_addCategory1Id" id ="check_addCategory1Id" value="1" />首页显示
			</td>
			<td>
				<input type="text" name="category2Name" id="category2Name" maxlength="20" size="14">
				<br/>
				<input type="button" id="addCategory2Id" value="添加二级类别" onclick="javascript:addCategory2();">
				<input type="checkbox" name="check_addCategory2Id" id ="check_addCategory2Id" value="1" />首页显示
			</td>
			<td>
				<input type="text" name="category3Name" id="category3Name" maxlength="20">
				<br/>
				<input type="button" id="addCategory3Id" value="添加三级类别" onclick="javascript:addCategory3();">
			</td>
			<td>
				<input type="text" name="propertyTypeName" id="propertyTypeName" maxlength="20">
				<br/>
				<input type="button" id="addPropertyTypeId"  value="添加属性类型" onclick="javascript:addPropertyType();">
			</td>
			<td>
				<input type="text" name="propertyValueName" id="propertyValueName" maxlength="20">
				<br/>
				<input type="button" id="addPropertyValueId" value="添加属性值" onclick="javascript:addPropertyValue();">
			</td>
		</tr>
		
		<tr>
			<td>
				<input type="text" name="category1NameModify" id="category1NameModify" maxlength="20" size="14">
				<br/>
				<input type="submit" id="modifyCategory1NameId" value="修改选中项" onclick="javascript:modifyCategory1Name();">
				<input type="checkbox" name="check_modifyCategory1Id" id="check_modifyCategory1Id" value="" />首页显示
			</td>
			<td>
				<input type="text" name="category2NameModify" id="category2NameModify" maxlength="20" size="14">
				<br/>
				<input type="button" id="modifyCategory2NameId" value="修改选中项" onclick="javascript:modifyCategory2Name();">
				<input type="checkbox" name="check_modifyCategory2Id" id="check_modifyCategory2Id" value="" />首页显示
			</td>
			<td>
				<input type="text" name="category3NameModify" id="category3NameModify" maxlength="20">
				<br/>
				<input type="button" id="modifyCategory3NameId" value="修改选中项" onclick="javascript:modifyCategory3Name();">
			</td>
			<td>
				<input type="text" name="propertyTypeNameModify" id="propertyTypeNameModify" maxlength="20">
				<br/>
				<input type="button" id="modifyPropertyTypeNameId" value="修改选中项" onclick="javascript:modifyPropertyTypeName();">
			</td>
			<td>
				<input type="text"  name="propertyValueNameModify" id="propertyValueNameModify" maxlength="20"> 
				<br/>
				<input type="button"  id="modifyPropertyValueNameId" value="修改选中项" onclick="javascript:modifyPropertyValueName();">
			</td>
		</tr>
		
		
		<tr>
			<td>
				<div><font color="red">级联删除且删除后无法恢复</font></div>
				<input type="submit" id="delCategory1Id" value="删除选中项" onclick="javascript:delCategory1();">
			</td>
			<td>  
				<div><font color="red">级联删除且删除后无法恢复</font></div>
				<input type="button" id="delCategory2Id" value="删除选中项" onclick="javascript:delCategory2();">
			</td>
			<td>
				<div><font color="red">级联删除且删除后无法恢复</font></div>
				<input type="button" id="delCategory3Id" value="删除选中项" onclick="javascript:delCategory3();">
			</td>
			<td>
				<div><font color="red">级联删除且删除后无法恢复</font></div>
				<input type="button" id="delPropertyTypeId" value="删除选中项" onclick="javascript:delPropertyType();">
			</td>
			<td>
				<div><font color="red">级联删除且删除后无法恢复</font></div>
				<input type="button" id="delPropertyValueId" value="删除选中项" onclick="javascript:delPropertyValue();">
			</td>
		</tr>
	</table>
</body>
</html>

<script>
    $(function(){
        $.ajax({
            type:"POST",
            url:"categoryAjax_queryCategory1All.action",
            dataType:"json",
            success:function(msg){
                var data = eval("("+msg+")");
                $.each(data,function(index,data){
                    var id = data.id;
                    var categoryName = data.categoryName;
                    $('#category1Select').get(0).options.add(new Option(categoryName,id));
                });
                //alert(msg.result);
            },
            error:function(er){
                //alert(er.responseText);
                alert('系统出错')
            }
        })
    });
</script>

